﻿using System;
using System.IO;
using System.Text;

namespace Shuba.Framework
{
    public class Encryption
    {
        public string Encrypt(string value)
        {
            /*
            //TripleDES
            byte[] encKey3DES = Encoding.ASCII.GetBytes("859197007083061185919800"); //Must be 24 characters in length
            byte[] encIV3DES = Encoding.ASCII.GetBytes("@5HU84!50lUt10Ns"); //Must be 16 characters in length
            EncryptorWrapper enc = new EncryptorWrapper(EncryptorWrapper.EncryptionTypes.TripleDES, encKey3DES, encIV3DES);
            */
            
            //RijnDael
            byte[] encKeyRijnDael = Encoding.ASCII.GetBytes("035huB@!859197007083061185919800"); //Must be 32 characters in length
            byte[] encIVRijnDael = Encoding.ASCII.GetBytes("@5HU84!50lUt10Ns"); //Must be 16 characters in length
            EncryptorWrapper enc = new EncryptorWrapper(EncryptorWrapper.EncryptionTypes.Rijndael, encKeyRijnDael, encIVRijnDael);

            /*
            //DES
            byte[] encKeyDES = Encoding.ASCII.GetBytes("035huB@!"); //Must be 8 characters in length
            byte[] encIVDES = Encoding.ASCII.GetBytes("@5HU84!50lUt10Ns"); //Must be 16 characters in length
            EncryptorWrapper enc = new EncryptorWrapper(EncryptionTypes.DES, encKeyDES, encIVDES);
           */

            return enc.Encrypt(value);

        }

        public string Decrypt(string value)
        {
            /*
            //TripleDES
            byte[] encKey3DES = Encoding.ASCII.GetBytes("859197007083061185919800"); //Must be 24 characters in length
            byte[] encIV3DES = Encoding.ASCII.GetBytes("@5HU84!50lUt10Ns"); //Must be 16 characters in length
            EncryptorWrapper enc = new EncryptorWrapper(EncryptorWrapper.EncryptionTypes.TripleDES, encKey3DES, encIV3DES);
            */
            
            //RijnDael
            byte[] encKeyRijnDael = Encoding.ASCII.GetBytes("035huB@!859197007083061185919800"); //Must be 32 characters in length
            byte[] encIVRijnDael = Encoding.ASCII.GetBytes("@5HU84!50lUt10Ns"); //Must be 16 characters in length
            EncryptorWrapper enc = new EncryptorWrapper(EncryptorWrapper.EncryptionTypes.Rijndael, encKeyRijnDael, encIVRijnDael);

            /*
            //DES
            byte[] encKeyDES = Encoding.ASCII.GetBytes("035huB@!"); //Must be 8 characters in length
            byte[] encIVDES = Encoding.ASCII.GetBytes("@5HU84!50lUt10Ns"); //Must be 16 characters in length
            EncryptorWrapper enc = new EncryptorWrapper(EncryptorWrapper.EncryptionTypes.DES, encKeyDES, encIVDES);
           */

            return enc.Decrypt(value);
        }
    }
}
